<?php
class View_Gallery{
	/**
	 * выводим маленькие изображения с подключением к плагину
	 *
	 */
	public static function showThumb($arrImages, $essence, $idEssence, $editFlag = false, $simple = false){
		if ($editFlag)			
			$mainImageId = Gallery::getMainImage($essence, $idEssence);
		echo '<div class="yoxview">';
			foreach ($arrImages as $arrImages){
				echo '<div class="' . ($simple ? 'imageSimpleThumb' : 'imageThumb') . '" id="image_' . $arrImages['ID_image'] . '">';
			    echo '<div class="image" ><a href="' . W_IMAGES . 'upload/' . $arrImages['name'] . '"><img src="' . W_IMAGES . 'upload/thumb/' . $arrImages['name'] . '" alt="' . $arrImages['title'] . '" title="' . $arrImages['title'] . '" /></a></div>';
			    if ($editFlag){
			    	echo '<p><input class="imageTitle" id="title_' . $arrImages['ID_image'] . '" maxlength="150" type="text" value="' . ($arrImages['title'] ? $arrImages['title'] : 'Название') . '" onkeyUp="gallery.updateTitle($(\'#title_' . $arrImages['ID_image'] . '\').val(), ' . $arrImages['ID_image'] . ');"/></p>';
			    	echo '<p>Сделать главной <input onClick="gallery.makeMainImage(' . $arrImages['ID_image'] . ', ' . $essence . ', ' . $idEssence . ')" type="checkbox" ' . ($mainImageId == $arrImages['ID_image'] ? 'checked="checked"' : '') . ' id="imageCheckBox_' . $arrImages['ID_image'] . '" class="imageCheckBox"/></p>';
			    	echo '<p><a class="js" href="javascript:gallery.deleteImage(' . $arrImages['ID_image'] . ', \'' . $arrImages['name'] . '\');">Удалить</a></p>';
			    }
			    elseif(!$simple) {
			    	echo '<p>boberstroi.ru/content/images/upload/' . $arrImages['name'] . '</p>';
			    }
				echo '</div>';
			}
		echo '</div>';
	}
}
?>